Skip to main content
The trace utilities module provides helper functions and classes for advanced tracing scenarios.

ThreadPoolExecutor

A context-aware ThreadPoolExecutor that preserves trace context across thread boundaries.

Key Features

  • Preserves parent-child relationships in traces
  • Maintains trace context across thread boundaries
  • Compatible with standard ThreadPoolExecutor API

Example with Nested Tracing

attributes

Context manager for adding attributes to calls.

Nested Attributes

Attributes can be nested and will merge:

set_tracing_enabled

Context manager to temporarily disable tracing.

get_current_call

Get the currently executing call within an op.

Summary Utilities

add_summary

Add custom summary metrics to a call.
These utilities are designed to work seamlessly with Weave’s tracing system. Always ensure weave.init() has been called before using these features.